package zz.app.ustbgsmanager.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by zz on 2018/6/1 21:06.
 */
public class NetworkUtils {
     public static boolean isNetworkAvaliable(Context context) {
        ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        if (manager != null) {
            NetworkInfo info;
            if((info=manager.getActiveNetworkInfo())!=null) {
                return NetworkInfo.State.CONNECTED == info.getState();
            }
        }
        return false;
    }
}
